var app = angular.module('MyApp',[]);
app.controller('loginController',function($scope,$http){

    /*登录操作*/
    $scope.loginSubmit = function () {
        $scope.userMsg = {userId:$scope.userId,password:$scope.password};
        $http({
            method: 'POST',
            url: 'teacher/loginSubmit',
            params: $scope.userMsg,
            headers: { 'Content-Type': 'application/x-www-form-urlencoded'}
        }).then(function successCallback(response) {
            console.log(response);
            $scope.isSuccess = response.data.isSuccess;
            if ($scope.isSuccess == 0){
                alert("登录成功！");
                window.location.href = "/classmsg.do";
                /*登陆成功 登录界面隐藏 个人信息显示*/
            }else if($scope.isSuccess == 1) {
                alert("登录失败,账号不存在！");
            }else {
                alert("登录失败,密码错误！");
            }
        }, function errorCallback(response) {
            console.log("登录失败！");
        });
    };

    $scope.emptyInput = function () {
        $scope.userId = "",
        $scope.password = ""
    };


});